package com.aaa.tmr.listener;

import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import lombok.Data;
import lombok.extern.log4j.Log4j2;

import java.util.ArrayList;
import java.util.List;

/**
 * @ fileName:DataListener
 * @ description:通用的数据监听器
 * @ author:zhz
 * @ createTime:2021/3/23 17:15
 */
@Data
@Log4j2
public class DataListener extends AnalysisEventListener {


    //导入数据集合
    private List list =new ArrayList();

    @Override
    public void invoke(Object o, AnalysisContext analysisContext) {
         log.info("解析到一条数据:{}"+o);
         list.add(o);
    }

    @Override
    public void doAfterAllAnalysed(AnalysisContext analysisContext) {
        log.info("所有数据解析完成！");
    }


}
